home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / msysjour / vol07 / 02 / controls / muscrdll.h < prev    next >
C/C++ Source or Header  |  1992-02-29  |  5KB  |  186 lines

  1. /*
  2.  * MUSCRDLL.H
  3.  *
  4.  * DLL Specific include file.
  5.  *
  6.  * Contains all definitions and and prototypes pertinent ONLY
  7.  * to the DLL.  API related information is contained in MUSCROLL.H.
  8.  * API in any way.
  9.  *
  10.  * Version 1.1, October 1991, Kraig Brockschmidt
  11.  *
  12.  */
  13.  
  14.  
  15. #include <custcntl.h>   //Standard Windows header file for custom controls.
  16. #include "muscroll.h"   //Get interface stuff for the control.
  17.  
  18.  
  19.  
  20. /*
  21.  * In window extra bytes we simply store a local handle to
  22.  * a MUSCROLL data structure.  The local memory is allocated
  23.  * from the control's local heap (either application or DLL)
  24.  * instead of from USER's heap, thereby saving system resources.
  25.  *
  26.  * Note that the window styles that are stored in the regular
  27.  * windwow structure are copied here.  This is to optimize access
  28.  * to these bits, avoiding extra calls to GetWindowLong.
  29.  */
  30.  
  31. typedef struct tagMUSCROLL
  32.     {
  33.     HWND        hWndAssociate;  //Associate window handle
  34.     DWORD       dwStyle;        //Copy of GetWindowLong(hWnd, GWL_STYLE)
  35.     WORD        iMin;           //Minimum position
  36.     WORD        iMax;           //Maximum position
  37.     WORD        iPos;           //Current position
  38.     WORD        wState;         //State flags
  39.     COLORREF    rgCr[CCOLORS];  //Configurable colors.
  40.     } MUSCROLL;
  41.  
  42. typedef MUSCROLL     *PMUSCROLL;
  43. typedef MUSCROLL FAR *LPMUSCROLL;
  44.  
  45. #define CBMUSCROLL sizeof(MUSCROLL)
  46.  
  47.  
  48.  
  49. //Offsets to use with GetWindowWord
  50. #define GWW_MUSCROLLHMEM    0
  51.  
  52. //Extra bytes for the window if the size of a local handle.
  53. #define CBWINDOWEXTRA       sizeof(HANDLE)
  54.  
  55. //Extra Class bytes.
  56. #define CBCLASSEXTRA        0
  57.  
  58.  
  59.  
  60. //Control state flags.
  61. #define MUSTATE_GRAYED      0x0001
  62. #define MUSTATE_HIDDEN      0x0002
  63. #define MUSTATE_MOUSEOUT    0x0004
  64. #define MUSTATE_UPCLICK     0x0008
  65. #define MUSTATE_DOWNCLICK   0x0010
  66. #define MUSTATE_LEFTCLICK   0x0008  //Repeated since MSS_VERTICAL and
  67. #define MUSTATE_RIGHTCLICK  0x0010  //MSS_HORIZONTAL are exclusive.
  68.  
  69. //Combination of click states.
  70. #define MUSTATE_CLICKED     (MUSTATE_LEFTCLICK | MUSTATE_RIGHTCLICK)
  71.  
  72. //Combination of state flags.
  73. #define MUSTATE_ALL         0x001F
  74.  
  75.  
  76.  
  77.  
  78. /*
  79.  * Macros to change the control state given a PMUSCROLL
  80.  * and state flag(s)
  81.  */
  82. #define StateSet(p, wFlags)    (p->wState |=  (wFlags))
  83. #define StateClear(p, wFlags)  (p->wState &= ~(wFlags))
  84. #define StateTest(p, wFlags)   (p->wState &   (wFlags))
  85.  
  86.  
  87.  
  88.  
  89. //Private functions specific to the control.
  90.  
  91. //INIT.C
  92. HANDLE FAR PASCAL LibMain(HANDLE, WORD, WORD, LPSTR);
  93. BOOL       PASCAL FRegisterControl(HANDLE);
  94. LONG       PASCAL LMicroScrollCreate(HWND, WORD, PMUSCROLL, LPCREATESTRUCT);
  95. BOOL       PASCAL FTextParse(LPSTR, LPINT, LPINT, LPINT);
  96. WORD       PASCAL WTranslateUpToChar(LPSTR FAR *, char);
  97.  
  98. //MSAPI.C
  99. LONG       PASCAL LMicroScrollAPI(HWND, WORD, WORD, LONG, PMUSCROLL);
  100.  
  101.  
  102. //MUSCROLL.C
  103. LONG   FAR PASCAL MicroScrollWndProc(HWND, WORD, WORD, LONG);
  104. void       PASCAL PositionChange(HWND, PMUSCROLL);
  105. void       PASCAL ClickedRectCalc(HWND, PMUSCROLL, LPRECT);
  106.  
  107.  
  108. //PAINT.C
  109. LONG       PASCAL LMicroScrollPaint(HWND, PMUSCROLL);
  110. void       PASCAL Draw3DButtonRect(HDC, HPEN, HPEN, WORD, WORD,\
  111.                                    WORD, WORD, BOOL);
  112.  
  113.  
  114.  
  115. //WEP.C
  116. void   FAR PASCAL WEP(int);
  117.  
  118.  
  119.  
  120.  
  121.  
  122. //Timer identifiers.
  123. #define IDT_FIRSTCLICK      500
  124. #define IDT_HOLDCLICK       501
  125.  
  126. #define CTICKS_FIRSTCLICK   400
  127. #define CTICKS_HOLDCLICK    50
  128.  
  129.  
  130. //Default range and position constants.
  131. #define IDEFAULTMIN         0
  132. #define IDEFAULTMAX         9
  133. #define IDEFAULTPOS         5
  134.  
  135.  
  136.  
  137.  
  138. //Stringtable identifiers
  139. #define IDS_CLASSNAME           0
  140. #define IDS_FULLNAME            1
  141. #define IDS_CREDITS             2
  142.  
  143. //Dialog editor interface string
  144. #define IDS_VERTICAL            3
  145. #define IDS_HORIZONTAL          4
  146. #define IDS_MSS_VERTICAL        5
  147. #define IDS_MSS_HORIZONTAL      6
  148. #define IDS_MSS_TEXTHASRANGE    7
  149. #define IDS_MSS_NOPEGSCROLL     8
  150. #define IDS_MSS_INVERTRANGE     9
  151. #define IDS_RANGEERROR          10
  152.  
  153.  
  154.  
  155.  
  156.  
  157. /*
  158.  * All that follows in this include file is specific to
  159.  * the dialog editor interface for the MicroScroll control.
  160.  */
  161.  
  162. //Identifiers for the Style dialog.
  163. #define ID_NULL                 -1
  164. #define ID_IDEDIT               100
  165. #define ID_TEXTEDIT             101
  166. #define ID_RADIOVERTICAL        102
  167. #define ID_RADIOHORIZONTAL      103
  168. #define ID_CHECKTEXTHASRANGE    104
  169. #define ID_CHECKNOPEGSCROLL     105
  170. #define ID_CHECKINVERTRANGE     106
  171.  
  172.  
  173.  
  174. //Dialog box identifiers.
  175. #define IDD_STYLEDIALOG         1
  176.  
  177.  
  178.  
  179.  
  180.  
  181. //Standard dialog editor callbacks.
  182. HANDLE FAR PASCAL HCtlInfo(void);
  183. WORD   FAR PASCAL WTranslateCtlFlags(DWORD, LPSTR, WORD);
  184. BOOL   FAR PASCAL FShowCtlStyleDlg(HWND, HANDLE, LPFNSTRTOID, LPFNIDTOSTR);
  185. BOOL   FAR PASCAL FCtlStyleDlgProc(HWND, WORD, WORD, LONG);
  186.